/*
import java.util.Scanner;

//斐波那契数列原理：
//
//  1  1   2   3   5   8  13   21
//  1 1+0 1+1 1+2 2+3 3+5 5+8 8+12
//  f(n) = f(n-1) + f(n-2);

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        System.out.print("please input FBNQ term: ");
        int n = sc.nextInt();
        int number = FBNQ(n);
        System.out.println("FBNQ result is: "+number);
    }
    public static int FBNQ(int n){
        if(n == 1 || n == 2)
            return 1;
        else
            return FBNQ(n -1)+FBNQ(n-2);
    }
}

 */

/*
     难点，递归难点
 */
//汉诺塔的递归问题

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        int iDishNum = 0;
        System.out.print("请输入盘子的数量：");
        Scanner scanner = new Scanner(System.in);
        iDishNum = scanner.nextInt();
        System.out.println("盘子的数量为："+iDishNum);
        String form = "A";
        String temp = "B";
        String to = "C";
        mover(iDishNum,form,temp,to);
    }

    public static void mover(int iDishNum,String form,String temp,String to){
        if(iDishNum == 1){
            System.out.println("将盘子"+iDishNum+"从塔座"+form+"移到目标塔座"+to);
        }
        else{
            mover(iDishNum -1 ,form,to,temp);
            System.out.println("将盘子"+iDishNum+"从塔座"+form+"移到目标塔座"+to);
            mover(iDishNum -1 ,temp, form, to);
        }
    }
}